//
//  YXSetttingController.m
//  YiXiu
//
//  Created by ZHY on 16/6/29.
//  Copyright © 2016年 zzz. All rights reserved.
//

#import "YXSetttingController.h"
#import "EventSettingItem.h"
#import "EventSettingGroup.h"
#import "personalDataViewController.h"

@interface YXSetttingController ()

@property (nonatomic, strong) UIView *YXHeaderView;
@property (nonatomic, strong) EventSettingGroup *group;

@end

@implementation YXSetttingController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.title = @"设置";
    
//        [self addHeaderView];
    //第一组
    [self addOneGroup];
    
    //第二组
    [self addTwoGroup];

}


 //第一组
- (void)addOneGroup{

    EventSettingItem *setting = [EventSettingItem itemWithText:@"清除缓存" image:nil type:EventSettingItemTypeArrow viewTag:9 arrowImageName:nil];
    
    EventSettingGroup *group = [[EventSettingGroup alloc] init];
    _group = group;
//    EventSettingGroup *group1 = [[EventSettingGroup alloc] init];
//    group.headerHeight = 10;
//    group.footerHeight = 10;
    group.rowHeight = 60;
    group.headerHeight = 150;
//    group.headerView = self.YXHeaderView;
    
   
    group.items = @[setting];
    
    
    
//    group1.items = @[setting3];
    [self.allGroups addObject:group];
//    [self.allGroups addObject:group1];
    
}

-(void)addTwoGroup
{
 
    EventSettingItem *setting1 = [EventSettingItem itemWithText:@"AppStore评分" image:nil type:EventSettingItemTypeArrow viewTag:9 arrowImageName:nil];
    
    EventSettingItem *setting2 = [EventSettingItem itemWithText:@"客服反馈" image:nil type:EventSettingItemTypeArrow viewTag:9 arrowImageName:nil];
    
    EventSettingItem *setting3 = [EventSettingItem itemWithText:@"关于一羞" image:nil type:EventSettingItemTypeArrow viewTag:9 arrowImageName:nil];
    

    
    
    EventSettingGroup *group = [[EventSettingGroup alloc] init];
    
    group.rowHeight = 60;
    
    group.items = @[setting1,setting2,setting3];
    
    [self.allGroups addObject:group];
    
}

-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    
    if(indexPath.section == 1 && indexPath.row ==1){
        
        personalDataViewController * per = [[personalDataViewController alloc]init];
        
        [self.navigationController pushViewController:per animated:YES];
        
    }
}


- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section{

    if(section == 0){
    UIView * view = [[UIView alloc]initWithFrame:CGRectMake(0, 0, KScreenWidth,self.group.headerHeight)];

    UIImageView * imageView = [[UIImageView alloc]initWithFrame:view.frame];
    
    [imageView setImage:[UIImage imageNamed:@"szbg"]];
    
        [view addSubview:imageView];
        
         return view;
    }else{
        
          return nil;
    }
}



- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}



@end
